package com.lizhe.conditional.config;

import com.lizhe.conditional.entity.City;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 类描述:
 *
 * @author Administrator
 * @create 2022-06-13 21:58
 */
@Slf4j
@Configuration
public class config {

    /**
     *   把这个Bean注释掉会出现空指针错误，因为 confi2 里 People注册Bean
     *   配置为@ConditionalOnBean(name = "city") city存在才初始化该bean
     *
     *   相反如果使用 @ConditionalOnMissingBean(name = "city") 刚好相反不存在条件
     */

    // @Bean
    // public City city() {
    //     City city = new City();
    //     city.setCityName("湖心岛");
    //     return city;
    // }

}